package com.aegean.MonitorExamSYS.conduction.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.aegean.MonitorExamSYS.conduction.business.ConductionBusiness;
import com.aegean.MonitorExaxSYS.model.ConductionValue;
import com.aegean.MonitorExaxSYS.model.MonitorValue;
import com.opensymphony.xwork2.ActionSupport;

@Controller("ShowMonitorList")
@Scope("prototype")
public class ShowMonitorList extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1779517243378544136L;
	@Resource
	ConductionBusiness business;
	private String query;
	private int start;
	private int limit;
	private int total;
	private int search_Id;
	private int big_Id;
	private List<MonitorValue> monitors = new ArrayList<MonitorValue>();
	private int state;
	public int getSearch_Id() {
		return search_Id;
	}
	public void setSearch_Id(int search_Id) {
		this.search_Id = search_Id;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public int getBig_Id() {
		return big_Id;
	}
	public void setBig_Id(int big_Id) {
		this.big_Id = big_Id;
	}
	public String getQuery() {
		return query;
	}
	public void setQuery(String query) {
		this.query = query;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	public List<MonitorValue> getMonitors() {
		return monitors;
	}
	public void setMonitors(List<MonitorValue> monitors) {
		this.monitors = monitors;
	}
	@Override
	public String execute() throws Exception {
		HttpSession session=ServletActionContext.getRequest().getSession();
		ConductionValue one=(ConductionValue) session.getAttribute("ConductionLogin");
		int conduction_Id=one.getConduction_Id();
		total=business.monitorListCount(conduction_Id, search_Id, big_Id, state, query);
		monitors=business.ShowMonitorListQuery(conduction_Id, search_Id, big_Id, state, query, start, limit);
		return SUCCESS;
	}

}
